package net.dgg.zz.credential.talent.service;

import net.dgg.zz.credential.talent.dao.TalentRecordDao;
import net.dgg.zz.credential.talent.entity.TalentRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class TalentRecordService {
    @Autowired
    private TalentRecordDao talentRecordDao;

    public Integer insert(TalentRecord talentRecord){
        return talentRecordDao.insert(talentRecord);
    }

    public List<TalentRecord> selectWithPage(Map params){
        try {
            params.put("orderDir", "desc");
            params.put("orderColumn", "operate_time");
            return talentRecordDao.selectWithPage(params);
        }catch (Exception e){
            List<TalentRecord> list  = new ArrayList<>();
            return list;
        }
    }

    public Integer count(Long talentId){
        Map params = new HashMap();
        params.put("orderDir", "desc");
        params.put("orderColumn", "operate_time");
        params.put("talentId",talentId);
        return talentRecordDao.count(params);
    }


}
